package controllers

import (
	"fmt"

	"github.com/astaxie/beego"
)

type MainController struct {
	beego.Controller
}

func (c *MainController) Fun0() {
	c.Data["mystr"] = "fxy's beego index"

	c.TplName = "test.html"
}

func (c *MainController) Fun1() {
	c.Data["mystr"] = "fxy's beego1"
	getname := c.GetString("namehtml")
	getpwd := c.GetString("passhtml")

	fmt.Println(getname)
	fmt.Println(getpwd)

	if getname == "abc" {
		c.Ctx.Redirect(302, "/succlogin")
		c.TplName = "test01.html"
	} else {
		c.Ctx.Redirect(200, "/myregster")
		c.TplName = "test02.html"
	}

}

func (c *MainController) Fun2() {
	c.Data["mystr"] = "login success"
	c.TplName = "test01.html"
}
func (c *MainController) Fun3() {
	c.Data["mystr"] = "index"
	c.TplName = "test.html"
	c.Ctx.Redirect(302, "/")
}

/*
func (c *MainController) Fun3() {

	c.TplName = "test02.html"
	fmt.Println("regstering")
}
*/
